// src/pages/login/index.tsx
import styles from "@pages/login/styles/styles.module.less";
import Header from "@shared/header";
import Back from "@shared/back";
import { useState } from "react";
import { useNavigate } from'react-router-dom';
export default function LoginPage() {
  // 手机号
  const [phone, setPhone] = useState<string>("");
  // 密码
  const [password, setPassword] = useState<string>("");
  // 跳转页面
  const navigate = useNavigate();

    const handleClick = () => {
        navigate('/');
    };
  return (
    <div className={styles.login_page}>
      <Header title={""} left={<Back />} />
      <h2>密码登录</h2>
      <form>
        <div className={styles.form_item}>
          <input type="text" onChange={(e)=>{
            setPhone(e.target.value);
          }} placeholder="请输入手机号" />
          {/* <p className={styles.error_message}>请输入手机号</p> */}
        </div>
        <div className={styles.form_item}>
          <input type="text" onChange={(e)=>{
            setPassword(e.target.value);
          }} placeholder="请输入密码" 
          />
          {/* 如果验证码正在发送, className={styles.active} */}
          {/* <button type="button">发送验证码</button> */}
          {/* <p className={styles.error_message}>请输入验证码</p> */}
        </div>
        <button className={styles.login_button} onClick={()=>{
          // 跳转首页
          handleClick()
          localStorage.setItem('token',phone)
        }}>登录</button>
      </form>
    </div>
  );
}